﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AmiEmuLib.Configuration.FiltersConfig
{
    /// <summary>
    /// Filter - hardware or software.
    /// </summary>
    public class Filter
    {
        /// <summary>
        /// Filter name. Not unique.
        /// </summary>
        public readonly string Name;

        /// <summary>
        /// Filter type.
        /// </summary>
        public readonly FilterType Type;

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="a_name"></param>
        /// <param name="a_type"></param>
        internal Filter(string a_name, FilterType a_type)
        {
            Name = a_name;
            Type = a_type;
        }

        /// <summary>
        /// Return display name. Unique.
        /// </summary>
        public string DisplayName
        {
            get
            {
                if (Type == FilterType.Software)
                    return Name + " (software)";
                else if (Type == FilterType.Shader)
                    return Name + " (D3D shader)";
                else
                    throw new NotImplementedException();
            }
        }

        public override int GetHashCode()
        {
            return Name.GetHashCode() ^ Type.GetHashCode();
        }

        public override bool Equals(object a_obj)
        {
            if (a_obj == null)
                return false;
            Filter filter = a_obj as Filter;
            if (filter == null)
                return false;

            return (Name == filter.Name) && (Type == filter.Type);
        }
    }
}
